3.78 \(\int \frac {(2-3 x+x^2) (d+e x+f x^2+g x^3+h x^4+i x^5)}{4-5 x^2+x^4} \, dx\)

Optimal. Leaf size=90 \[ \log (x+1) (d-e+f-g+h-i)-\log (x+2) (d-2 e+4 f-8 g+16 h-32 i)+x (f-3 g+7 h-15 i)+\frac {1}{2} x^2 (g-3 h+7 i)+\frac {1}{3} x^3 (h-3 i)+\frac {i x^4}{4} \]

[Out]

(f-3*g+7*h-15*i)*x+1/2*(g-3*h+7*i)*x^2+1/3*(h-3*i)*x^3+1/4*i*x^4+(d-e+f-g+h-i)*ln(1+x)-(d-2*e+4*f-8*g+16*h-32*
i)*ln(2+x)

________________________________________________________________________________________

Rubi [A]  time = 0.11, antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 46, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {1586, 1657, 632, 31} \[ \log (x+1) (d-e+f-g+h-i)-\log (x+2) (d-2 e+4 f-8 g+16 h-32 i)+x (f-3 g+7 h-15 i)+\frac {1}{2} x^2 (g-3 h+7 i)+\frac {1}{3} x^3 (h-3 i)+\frac {i x^4}{4} \]

Antiderivative was successfully verified.

[In]

Int[((2 - 3*x + x^2)*(d + e*x + f*x^2 + g*x^3 + h*x^4 + i*x^5))/(4 - 5*x^2 + x^4),x]

[Out]

(f - 3*g + 7*h - 15*i)*x + ((g - 3*h + 7*i)*x^2)/2 + ((h - 3*i)*x^3)/3 + (i*x^4)/4 + (d - e + f - g + h - i)*L
og[1 + x] - (d - 2*e + 4*f - 8*g + 16*h - 32*i)*Log[2 + x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 632

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[
(c*d - e*(b/2 - q/2))/q, Int[1/(b/2 - q/2 + c*x), x], x] - Dist[(c*d - e*(b/2 + q/2))/q, Int[1/(b/2 + q/2 + c*
x), x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] && NiceSqrtQ[b^2 - 4*a*
c]

Rule 1586

Int[(u_.)*(Px_)^(p_.)*(Qx_)^(q_.), x_Symbol] :> Int[u*PolynomialQuotient[Px, Qx, x]^p*Qx^(p + q), x] /; FreeQ[
q, x] && PolyQ[Px, x] && PolyQ[Qx, x] && EqQ[PolynomialRemainder[Px, Qx, x], 0] && IntegerQ[p] && LtQ[p*q, 0]

Rule 1657

Int[(Pq_)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[Pq*(a + b*x + c*x^2)^p, x
], x] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rubi steps

\begin {align*} \int \frac {\left (2-3 x+x^2\right ) \left (d+e x+f x^2+g x^3+h x^4+78 x^5\right )}{4-5 x^2+x^4} \, dx &=\int \frac {d+e x+f x^2+g x^3+h x^4+78 x^5}{2+3 x+x^2} \, dx\\ &=\int \left (-1170+f-3 g+7 h+(546+g-3 h) x-(234-h) x^2+78 x^3+\frac {2340+d-2 f+6 g-14 h+(2418+e-3 f+7 g-15 h) x}{2+3 x+x^2}\right ) \, dx\\ &=-(1170-f+3 g-7 h) x+\frac {1}{2} (546+g-3 h) x^2-\frac {1}{3} (234-h) x^3+\frac {39 x^4}{2}+\int \frac {2340+d-2 f+6 g-14 h+(2418+e-3 f+7 g-15 h) x}{2+3 x+x^2} \, dx\\ &=-(1170-f+3 g-7 h) x+\frac {1}{2} (546+g-3 h) x^2-\frac {1}{3} (234-h) x^3+\frac {39 x^4}{2}+(-78+d-e+f-g+h) \int \frac {1}{1+x} \, dx-(-2496+d-2 e+4 f-8 g+16 h) \int \frac {1}{2+x} \, dx\\ &=-(1170-f+3 g-7 h) x+\frac {1}{2} (546+g-3 h) x^2-\frac {1}{3} (234-h) x^3+\frac {39 x^4}{2}-(78-d+e-f+g-h) \log (1+x)+(2496-d+2 e-4 f+8 g-16 h) \log (2+x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.04, size = 91, normalized size = 1.01 \[ \log (x+1) (d-e+f-g+h-i)+\log (x+2) (-d+2 e-4 f+8 g-16 h+32 i)+x (f-3 g+7 h-15 i)+\frac {1}{2} x^2 (g-3 h+7 i)+\frac {1}{3} x^3 (h-3 i)+\frac {i x^4}{4} \]

Antiderivative was successfully verified.

[In]

Integrate[((2 - 3*x + x^2)*(d + e*x + f*x^2 + g*x^3 + h*x^4 + i*x^5))/(4 - 5*x^2 + x^4),x]

[Out]

(f - 3*g + 7*h - 15*i)*x + ((g - 3*h + 7*i)*x^2)/2 + ((h - 3*i)*x^3)/3 + (i*x^4)/4 + (d - e + f - g + h - i)*L
og[1 + x] + (-d + 2*e - 4*f + 8*g - 16*h + 32*i)*Log[2 + x]

________________________________________________________________________________________

fricas [A]  time = 0.82, size = 84, normalized size = 0.93 \[ \frac {1}{4} \, i x^{4} + \frac {1}{3} \, {\left (h - 3 \, i\right )} x^{3} + \frac {1}{2} \, {\left (g - 3 \, h + 7 \, i\right )} x^{2} + {\left (f - 3 \, g + 7 \, h - 15 \, i\right )} x - {\left (d - 2 \, e + 4 \, f - 8 \, g + 16 \, h - 32 \, i\right )} \log \left (x + 2\right ) + {\left (d - e + f - g + h - i\right )} \log \left (x + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2-3*x+2)*(i*x^5+h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="fricas")

[Out]

1/4*i*x^4 + 1/3*(h - 3*i)*x^3 + 1/2*(g - 3*h + 7*i)*x^2 + (f - 3*g + 7*h - 15*i)*x - (d - 2*e + 4*f - 8*g + 16
*h - 32*i)*log(x + 2) + (d - e + f - g + h - i)*log(x + 1)

________________________________________________________________________________________

giac [A]  time = 0.39, size = 97, normalized size = 1.08 \[ \frac {1}{4} \, i x^{4} + \frac {1}{3} \, h x^{3} - i x^{3} + \frac {1}{2} \, g x^{2} - \frac {3}{2} \, h x^{2} + \frac {7}{2} \, i x^{2} + f x - 3 \, g x + 7 \, h x - 15 \, i x - {\left (d + 4 \, f - 8 \, g + 16 \, h - 32 \, i - 2 \, e\right )} \log \left ({\left | x + 2 \right |}\right ) + {\left (d + f - g + h - i - e\right )} \log \left ({\left | x + 1 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2-3*x+2)*(i*x^5+h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="giac")

[Out]

1/4*i*x^4 + 1/3*h*x^3 - i*x^3 + 1/2*g*x^2 - 3/2*h*x^2 + 7/2*i*x^2 + f*x - 3*g*x + 7*h*x - 15*i*x - (d + 4*f -
8*g + 16*h - 32*i - 2*e)*log(abs(x + 2)) + (d + f - g + h - i - e)*log(abs(x + 1))

________________________________________________________________________________________

maple [A]  time = 0.01, size = 134, normalized size = 1.49 \[ \frac {i \,x^{4}}{4}+\frac {h \,x^{3}}{3}-i \,x^{3}+\frac {g \,x^{2}}{2}-\frac {3 h \,x^{2}}{2}+\frac {7 i \,x^{2}}{2}-d \ln \left (x +2\right )+d \ln \left (x +1\right )+2 e \ln \left (x +2\right )-e \ln \left (x +1\right )+f x -4 f \ln \left (x +2\right )+f \ln \left (x +1\right )-3 g x +8 g \ln \left (x +2\right )-g \ln \left (x +1\right )+7 h x -16 h \ln \left (x +2\right )+h \ln \left (x +1\right )-15 i x +32 i \ln \left (x +2\right )-i \ln \left (x +1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2-3*x+2)*(i*x^5+h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x)

[Out]

1/4*i*x^4+1/3*h*x^3-i*x^3+1/2*g*x^2-3/2*h*x^2+7/2*i*x^2+f*x-3*g*x+7*h*x-15*i*x+d*ln(x+1)-e*ln(x+1)+f*ln(x+1)-g
*ln(x+1)+h*ln(x+1)-i*ln(x+1)-d*ln(x+2)+2*e*ln(x+2)-4*f*ln(x+2)+8*g*ln(x+2)-16*h*ln(x+2)+32*i*ln(x+2)

________________________________________________________________________________________

maxima [A]  time = 0.44, size = 84, normalized size = 0.93 \[ \frac {1}{4} \, i x^{4} + \frac {1}{3} \, {\left (h - 3 \, i\right )} x^{3} + \frac {1}{2} \, {\left (g - 3 \, h + 7 \, i\right )} x^{2} + {\left (f - 3 \, g + 7 \, h - 15 \, i\right )} x - {\left (d - 2 \, e + 4 \, f - 8 \, g + 16 \, h - 32 \, i\right )} \log \left (x + 2\right ) + {\left (d - e + f - g + h - i\right )} \log \left (x + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2-3*x+2)*(i*x^5+h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="maxima")

[Out]

1/4*i*x^4 + 1/3*(h - 3*i)*x^3 + 1/2*(g - 3*h + 7*i)*x^2 + (f - 3*g + 7*h - 15*i)*x - (d - 2*e + 4*f - 8*g + 16
*h - 32*i)*log(x + 2) + (d - e + f - g + h - i)*log(x + 1)

________________________________________________________________________________________

mupad [B]  time = 0.08, size = 86, normalized size = 0.96 \[ x^3\,\left (\frac {h}{3}-i\right )-\ln \left (x+2\right )\,\left (d-2\,e+4\,f-8\,g+16\,h-32\,i\right )+\ln \left (x+1\right )\,\left (d-e+f-g+h-i\right )+\frac {i\,x^4}{4}+x^2\,\left (\frac {g}{2}-\frac {3\,h}{2}+\frac {7\,i}{2}\right )+x\,\left (f-3\,g+7\,h-15\,i\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((x^2 - 3*x + 2)*(d + e*x + f*x^2 + g*x^3 + h*x^4 + i*x^5))/(x^4 - 5*x^2 + 4),x)

[Out]

x^3*(h/3 - i) - log(x + 2)*(d - 2*e + 4*f - 8*g + 16*h - 32*i) + log(x + 1)*(d - e + f - g + h - i) + (i*x^4)/
4 + x^2*(g/2 - (3*h)/2 + (7*i)/2) + x*(f - 3*g + 7*h - 15*i)

________________________________________________________________________________________

sympy [A]  time = 2.59, size = 122, normalized size = 1.36 \[ \frac {i x^{4}}{4} + x^{3} \left (\frac {h}{3} - i\right ) + x^{2} \left (\frac {g}{2} - \frac {3 h}{2} + \frac {7 i}{2}\right ) + x \left (f - 3 g + 7 h - 15 i\right ) + \left (- d + 2 e - 4 f + 8 g - 16 h + 32 i\right ) \log {\left (x + \frac {4 d - 6 e + 10 f - 18 g + 34 h - 66 i}{2 d - 3 e + 5 f - 9 g + 17 h - 33 i} \right )} + \left (d - e + f - g + h - i\right ) \log {\left (x + 1 \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**2-3*x+2)*(i*x**5+h*x**4+g*x**3+f*x**2+e*x+d)/(x**4-5*x**2+4),x)

[Out]

i*x**4/4 + x**3*(h/3 - i) + x**2*(g/2 - 3*h/2 + 7*i/2) + x*(f - 3*g + 7*h - 15*i) + (-d + 2*e - 4*f + 8*g - 16
*h + 32*i)*log(x + (4*d - 6*e + 10*f - 18*g + 34*h - 66*i)/(2*d - 3*e + 5*f - 9*g + 17*h - 33*i)) + (d - e + f
 - g + h - i)*log(x + 1)

________________________________________________________________________________________